package com.five.controller.backstage;

import com.five.dao.backstage.FacTypeDao;
import com.five.entity.backstage.TFacType;
import com.five.entity.backstage.TStaff;
import com.five.util.LayTable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * @Author: 常鹏宇
 * @Description:
 * @Date: 2020/11/23 22:49
 */
@RestController
@RequestMapping("Factype")
public class FacTypeController {
    @Autowired
    private FacTypeDao facTypeDao;
    @RequestMapping("facType")
    @ResponseBody
    public LayTable queryAll(Integer page,Integer limit,TFacType tFacType){

        List<Map> maps = facTypeDao.queryAll(page,limit,tFacType);
        //获取数据总条数
        int i=facTypeDao.getCount(tFacType);

        LayTable table = new LayTable(i, maps);
        return table;
    }
    @RequestMapping("addFacType")
    @ResponseBody
    public void addFacType(TFacType tFacType){
        facTypeDao.addFacType(tFacType);
    }
    @RequestMapping("delFacType")
    @ResponseBody
    public void delFacType(TFacType tFacType){
        facTypeDao.delFacType(tFacType);
    }

    @RequestMapping("bad")
    public int updata(Integer id){
        int i=facTypeDao.bad(id);
        if (i>0){
            return i;
        }
        return -1;
    }
    @RequestMapping("good")
    public int updatagood(Integer id){
        int i=facTypeDao.good(id);
        if (i>0){
            return i;
        }
        return -1;
    }
}
